//
//  Second.m
//  SNHEventKit_Example
//
//  Created by 陈建蕾 on 2018/6/22.
//  Copyright © 2018年 chenjianlei. All rights reserved.
//

#import "Second.h"

@interface Second ()
@property (nonatomic, weak) id<SNHEventDelegate> delegate;
@end

@implementation Second

- (instancetype)initWithDelegate:(id<SNHEventDelegate>)delegate {
    if (self = [super init]) {
        _delegate = delegate;
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor redColor];
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
#if 0
    SNHEvent *a = [SNHEvent shareInstance:KSNHEventNameLiveModuleStart];
    a.params = @"AAAAAAA";
    [self.delegate onActionEvent:a];
    [self dismissViewControllerAnimated:YES completion:nil];
    
#else
    SNHEvent *a = [[SNHEvent alloc] initWithEvent:KSNHEventNameLiveModuleEnd];
    a.params = @{@"a":@"b",@"c":@"d"};
    [self.delegate onActionEvent:a];
    [self dismissViewControllerAnimated:YES completion:nil];
#endif
    SNHEvent *b = [SNHEvent new];
    b.eventName = KSNHEventNameCancel;
    b.params = @"CCCCCCC";
    [self.delegate onActionEvent:b];
}

@end
